package member.member.action;

import m.common.action.ActionRequest;
import m.common.action.RequestMethod;
import m.common.model.util.ModelQueryList;
import m.common.model.util.QueryCondition;
import m.system.util.JSONMessage;
import member.base.model.ServeGoods;
import member.base.model.ServeType;
import member.base.util.PowerUtil;

@ActionRequest(name = "action/member/serveGoods",description = "服务商品")
public class ServeGoodsAction extends MemberAction{
    @RequestMethod(description = "服务类型")
    public JSONMessage serveType() throws Exception {
        return JSONMessage.success("查询成功")
            .push("list",
                ModelQueryList.getModelList(ServeType.class,new String[]{"*"},null,
                    QueryCondition.eq("business.oid", getSession().getBusiness().getOid())
                )
            );
    }
    @RequestMethod(description = "服务商品列表")
    public JSONMessage getAllList() throws Exception {
        ModelQueryList queryList=toQueryList(ServeGoods.class,"*","type.*","store.name","store.color");
        queryList.addCondition(QueryCondition.eq("business.oid", getSession().getBusiness().getOid()));
        return JSONMessage.success("查询成功").push("page",ModelQueryList.getModelPageInfo(queryList));
    }
}
